<?php 
require "Controller.php";
require "../Admin/Model/UserModel.php";
class UserController extends Controller{
	
	function __construct(){
		parent::__construct();
		$this->mod=new UserModel();
	}
	public function listusers(){

		$userdata=$this->mod->getUserList();
		$this->assign('users',$userdata);//
		$this->display(); 
		
	}
	
	public function userform(){
		$this->display();
	}
	public function adduser(){
		$result=$this->mod->addUserInfo($_POST);
		if($result==true){
			echo "添加成功！<br>";
			echo "<a href='index.php?c=user&m=listusers'>如果没有跳转，请点这里跳转</a>";
		}
		else{
			echo "添加失败！<br>";
			echo "<a href='index.php?c=user&m=listusers'>如果没有跳转，请点这里跳转</a>";
			
		}
	}//adduser end

	//修改用户的信息
	public function edituser(){
		
		$data=$this->mod->getUserbyID();
		$this->assign('user',$data);
		$this->display();
	}
	public function updateuser(){
		$result=$this->mod->updateUserInfo();
		if($result==true)
		echo "更新成功！<br>";
		echo ' <a href="index.php?c=user&m=listusers">如果没有跳转，请点这里跳转</a>';	
	}
	public function deluser(){
		$result=$this->mod->del();
		if($result==true)
		echo "删除成功！<br>";
		echo ' <a href="index.php?c=user&m=listusers">如果没有跳转，请点这里跳转</a>';	
	}
}

 ?>
